package justdoit.view;

import java.awt.Color;
import javax.swing.JProgressBar;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 * The ProgressBar displayed in TaskListTable
 * @author Can and shadone
 */
public class ProgressBarInTable extends JProgressBar implements ChangeListener{

    int progressValue = this.getValue();

    public ProgressBarInTable(int progress) {
        super(0, 100);
        this.setValue(progress);
        this.setBackground(Color.white);
        this.addChangeListener(changeListener);
        this.setVisible(true);
    }

    public Integer getProgress() {
        return progressValue;
    }


    public void stateChanged(ChangeEvent e) {
        JSlider progress = (JSlider) e.getSource();
        progressValue = progress.getValue();
        this.setValue(progressValue);
        //progressLabel.setText(Integer.toString(progressValue));
    }

    public static void main(String[] args) {
        ProgressBarInTable pb = new ProgressBarInTable(10);
        //pb.setVisible(true);
    }
}
